//! \file Behavior_TODO.h
//! \brief Defines the <code>fullsail_ai::fundamentals::Selector</code> class.
//! \author Jeremiah Blanchard

#include <queue>
#include <stack>
#include "Selector.h"

namespace fullsail_ai { namespace fundamentals {

	Selector::Selector(char const* _description) : Behavior(_description)
	{
	}

	bool Selector::run(void (*dataFunction)(Behavior const*), Agent* agent)
	{
		// check my own children and decide whether i need to return success or failure based on what they return
		for(unsigned int i = 0;i < getChildCount();++i)
		{
			if(getChild(i)->run(dataFunction,agent))
			{
				dataFunction(this);
				return true;
			}
		}
		return false;
	}

}}  // namespace fullsail_ai::fundamentals
